package com.sacc.controller;

import com.power.common.model.CommonResult;
import com.sacc.pojo.OriginDetail;
import com.sacc.service.OriginDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 滚~韬
 * @date 2022/5/7 15:45
 */
@RestController
@RequestMapping("/news/origin")
public class OriginDetailController {
    @Autowired
    private OriginDetailService originDetailService;

    /**
     * 添加源信息
     * @param originDetail
     * @return
     */
    @PostMapping("/add")
    public CommonResult AddOriginDetail(@RequestBody OriginDetail originDetail){
        return originDetailService.AddOriginDetail(originDetail);
    }

    /**
     * 删除源信息
     * @param productOriginId
     * @return
     */
    @PostMapping("/delete")
    public CommonResult DeleteOriginDetail(@RequestParam Integer productOriginId){
        return originDetailService.DeleteOriginDetail(productOriginId);
    }

    /**
     * 得到源信息
     * @param productOriginId
     * @return
     */
    @GetMapping("/get")
    public OriginDetail GetOriginDetail(@RequestParam Integer productOriginId) {
        return originDetailService.GetOriginDetail(productOriginId);
    }
}
